<style lang="less">
  @import '../../styles/common.less';
  @import '../../addressBook/index.less';
  @import '../../tables/components/table.less';
</style>

<template>
  <div class="address">
    <Row class="row">
      <Col span="6" class="list-div">
      <Card>
        <p slot="title">
          社区管理
        </p>
        <div class="tree-div user-tree-div">
          <Tree :data="TreeData" children-key="children"
                @on-select-change="onTree" :render="renderContent"></Tree>
        </div>
      </Card>
      </Col>
      <Col span="18" class="padding-left-10 list-div">
      <Card id="TableCard">
        <p slot="title">
          <Icon type="md-people" size="24"></Icon>
          住户列表
        </p>
        <div class="table-head">
          <Button type="primary" class="Button" @click="del_house_Data()">删除</Button>
          <Button type="primary" class="Button" @click="add_house()" v-if="type == 'floor'">添加</Button>
        </div>
        <Row class="margin-top-10">
          <Table stripe border :columns="columns" :data="data"
                 @on-selection-change="selectionChange" :height="TableHeight"></Table>
          <div style="margin: 10px;overflow: hidden;height: 36px;">
            <div style="float: right;">
              <Page :total="total" :current="page" @on-change="changePage" show-elevator></Page>
            </div>
          </div>
        </Row>
      </Card>
      </Col>
      <!--小区-->
      <Modal v-model="community_Data.showModal" :width="600" :closable='false' :mask-closable=false
             class-name="vertical-center-modal" class="Modal-Detail-div">
        <h3 slot="header" style="color:#2D8CF0">编辑小区信息</h3>
        <Form :label-width="100" label-position="right">
          <FormItem label="小区名称">
            <Input v-model="community_Data.name" placeholder="请输入小区名称"></Input>
          </FormItem>
        </Form>
        <div slot="footer">
          <Button type="text" @click="cancelMobile">取消</Button>
          <Button type="primary" :loading="saveLoading" @click="save_community_Data">保存</Button>
        </div>
      </Modal>
      <!--楼-->
      <Modal v-model="building_Data.showModal" :width="600" :closable='false' :mask-closable=false
             class-name="vertical-center-modal" class="Modal-Detail-div">
        <h3 slot="header" style="color:#2D8CF0">编辑楼号信息</h3>
        <Form :label-width="100" label-position="right">
          <FormItem label="楼号">
            <Input v-model="building_Data.name" placeholder="请输入楼号"></Input>
          </FormItem>
        </Form>
        <div slot="footer">
          <Button type="text" @click="cancelMobile">取消</Button>
          <Button type="primary" :loading="saveLoading" @click="save_building_Data">保存</Button>
        </div>
      </Modal>
      <!--单元-->
      <Modal v-model="unit_Data.showModal" :width="600" :closable='false' :mask-closable=false
             class-name="vertical-center-modal" class="Modal-Detail-div">
        <h3 slot="header" style="color:#2D8CF0">编辑单元信息</h3>
        <Form :label-width="100" label-position="right">
          <FormItem label="单元号">
            <Input v-model="unit_Data.name" placeholder="请输入单元号"></Input>
          </FormItem>
        </Form>
        <div slot="footer">
          <Button type="text" @click="cancelMobile">取消</Button>
          <Button type="primary" :loading="saveLoading" @click="save_unit_Data">保存</Button>
        </div>
      </Modal>
      <!--楼层-->
      <Modal v-model="floor_Data.showModal" :width="600" :closable='false' :mask-closable=false
             class-name="vertical-center-modal" class="Modal-Detail-div">
        <h3 slot="header" style="color:#2D8CF0">编辑楼层信息</h3>
        <Form :label-width="100" label-position="right">
          <FormItem label="楼层">
            <Input v-model="floor_Data.name" placeholder="请输入楼层"></Input>
          </FormItem>
        </Form>
        <div slot="footer">
          <Button type="text" @click="cancelMobile">取消</Button>
          <Button type="primary" :loading="saveLoading" @click="save_floor_Data">保存</Button>
        </div>
      </Modal>
      <!--门牌号-->
      <Modal v-model="house_Data.showModal" :width="600" :closable='false' :mask-closable=false
             class-name="vertical-center-modal" class="Modal-Detail-div">
        <h3 slot="header" style="color:#2D8CF0">编辑门牌号信息</h3>
        <Form :label-width="100" label-position="right">
          <FormItem label="门牌号">
            <Input v-model="house_Data.name" placeholder="请输入门牌号"></Input>
          </FormItem>
        </Form>
        <div slot="footer">
          <Button type="text" @click="cancelMobile">取消</Button>
          <Button type="primary" :loading="saveLoading" @click="save_house_Data">保存</Button>
        </div>
      </Modal>
    </Row>
  </div>
</template>

<script>
  import Cookies from 'js-cookie';
  import Util from '../../../libs/util';
  import Utils from '../../../libs/mod.utils';
  import String from '../../../libs/mod.string';
  import Modal from '../../../libs/mod.Modal';
  export default {
    data () {
      return {
        TableHeight: 300,
        spanList: 18,
        showDetail: false,
        total: 0,
        page: 1,
        size: 10,
        buttonProps: {
          type: 'ghost',
          size: 'small',
        },
        id: '',
        type: '',
        showCurrentTableData: false,
        columns: [
          {
            type: 'selection',
            width: 60,
            align: 'center'
          },
          {
            key: 'committee',
            title: '居委会',
          },
          {
            key: 'community',
            title: '小区',
          },
          {
            key: 'building',
            title: '楼号',
          },
          {
            key: 'unit',
            title: '单元',
          },
          {
            key: 'floor',
            title: '楼层',
          },
          {
            key: 'house',
            title: '门牌号',
          },
          {
            key: 'full_name',
            title: '户主',
          },
          {
            title: 'Action',
            key: 'action',
            width: 100,
            align: 'center',
            render: (h, params) => {
              return h('div', [
                h('Button', {
                  props: {
                    type: 'primary',
                    size: 'small'
                  },
                  style: {
                    marginRight: '5px'
                  },
                  on: {
                    click: e => {
                      e.stopPropagation();
                      var data = params.row;
                      this.update_house_Data(data);
                    }
                  }
                }, '修改')
              ]);
            }
          }
        ],
        data: [],
        dataDetail: {},
        TreeData: [],
        saveLoading: false,
        ajaxType: 'add',
        selectionArr: [],
        community_Data: {
          showModal: false,
          ajaxType: 'add',
          id: '',
          pid: '',
          name: '',
        },
        building_Data: {
          showModal: false,
          ajaxType: 'add',
          id: '',
          pid: '',
          name: '',
        },
        unit_Data: {
          showModal: false,
          ajaxType: 'add',
          id: '',
          pid: '',
          name: '',
        },
        floor_Data: {
          showModal: false,
          ajaxType: 'add',
          id: '',
          pid: '',
          name: '',
        },
        house_Data: {
          showModal: false,
          ajaxType: 'add',
          id: '',
          pid: '',
          name: '',
        },

      };
    },
    computed: {},
    mounted () {
      var _this = this;
      _this.getTreeData();
      _this.type = 'neighborhood';
      _this.id = 1;
      _this.getData();
      _this.$nextTick(function () {
        var height = $('#TableCard').height();
        var TableHeight = height - 51 - 36 - 32 - 10 - 56;
        _this.TableHeight = TableHeight;
      });
    },
    methods: {
      // 搜索
      searchFun: function () {
        var _this = this;
      },
      changePage (page) {
        var _this = this;
        _this.selectionArr = [];
        _this.page = page;
        _this.getData();
      },
      // 列表多选 选中数据
      selectionChange: function (selection) {
        var _this = this;
        _this.selectionArr = selection;
      },
      getTreeData: function () {
        var _this = this;
        var data = {
          uid: Util.toJson(localStorage.getItem('userInfo')).id,
        };
        var params = {
          url: '/sd/social-repo/list',
          type: Util.method.get,
          data: data,
          success: _successFun
        };
        Util.ajax(_this, params);
        function _successFun(res) {
          if (res.result == 0) {
            var data = res.data || [];
            var dataArr = data;
            _this.dataArrFun(dataArr);
            _this.TreeData = dataArr;
          } else {
            _this.$Message.error('查询社区信息失败!');
          }
        }
      },
      dataArrFun: function (arr) {
        var _this = this;
        if (arr.length > 0) {
          for (var k in arr) {
            if (!arr[k]) {
              continue;
            }
            arr[k].expand = true;
            var dataArr = arr[k].children || [];
            _this.dataArrFun(dataArr);
          }
        }
      },
      onTree: function (data) {
        var _this = this;
        var id = data.id;
        var type = data.type;
        _this.selectionArr = [];
        _this.id = id;
        _this.type = type;
        _this.page = 1;
        _this.getData();
      },
      getData: function () {
        var _this = this;
        var data = {
          uid: Util.toJson(localStorage.getItem('userInfo')).id,
          type: _this.type,
          id: _this.id,
          page: _this.page,
          size: _this.size,
        };
        var params = {
          url: '/sd/social-repo/house/getHouseListBytype',
          type: Util.method.get,
          data: data,
          success: _successFun
        };
        Util.ajax(_this, params);
        function _successFun(res) {
          if (res.result == 0) {
            var data = res.data || [];
            _this.total = res.rows || 0;
            _this.data = data;
          } else {
            _this.$Message.error('查询人员信息失败!');
          }
        }
      },
      onRowData: function (_data) {
        var _this = this;
      },
      renderContent (h, {root, node, data}) {
        var _this = this;
        var nodeKey = node.nodeKey;
        var add1 = h('Button', {
          props: Object.assign({}, this.buttonProps, {
            icon: 'ios-add',
            type: 'default'
          }),
          style: {
            marginRight: '0px'
          },
          on: {
            click: e => {
              e.stopPropagation();
              this.addFun(data)
            }
          }
        });
        var add = h('Button', {
          props: Object.assign({}, this.buttonProps, {
            icon: 'ios-add',
            type: 'default'
          }),
          style: {
            marginRight: '4px'
          },
          on: {
            click: e => {
              e.stopPropagation();
              this.addFun(data)
            }
          }
        });
        var update = h('Button', {
          props: Object.assign({}, this.buttonProps, {
            icon: 'ios-create-outline',
            type: 'default'
          }),
          style: {
            marginRight: '4px'
          },
          on: {
            click: e => {
              e.stopPropagation();
              this.updateFun(data)
            }
          }
        });
        var del = h('Button', {
          props: Object.assign({}, this.buttonProps, {
            icon: 'ios-remove',
            type: 'default'
          }),
          on: {
            click: e => {
              e.stopPropagation();
              this.removeFun(data)
            }
          }
        });
        var type = data.type || '';
        var marginRight = '16px';
        var ButtonArr = [];
        if (type == 'neighborhood') {

        } else if (type == 'committee') {
          ButtonArr.push(add1);
        } else {
          ButtonArr.push(add);
          ButtonArr.push(update);
          ButtonArr.push(del);
        }

        return h('span', {
          style: {
            display: 'inline-block',
            width: '100%',
            cursor: 'pointer'
          },
          on: {
            click: () => {
              _this.onTree(data);
            }
          }
        }, [
          h('span', [
            h('Icon', {
              props: {
                type: 'ios-paper-outline'
              },
              style: {
                marginRight: '8px'
              }
            }),
            h('span', data.title)
          ]),
          h('span', {
                style: {
                  display: 'inline-block',
                  float: 'right',
                  marginRight: marginRight
                }
              },
              ButtonArr
          )
        ]);
      },
      // 添加
      addFun: function (_data) {
        var _this = this;
        var type = _data.type;
        switch (type) {
          case 'committee' : // 居委会
            _this.add_community_Data(_data);
            break;
          case 'community' : // 小区
            _this.add_building_Data(_data);
            break;
          case 'building' : // 楼
            _this.add_unit_Data(_data);
            break;
          case 'unit' : // 单元
            _this.add_floor_Data(_data);
            break;
          case 'floor' : // 层
            _this.add_house_Data(_data);
            break;
          default :
            break;
        }
      },
      // 修改
      updateFun: function (_data) {
        var _this = this;
        var type = _data.type;
        switch (type) {
          case 'community' : // 小区
            _this.update_community_Data(_data);
            break;
          case 'building' : // 楼
            _this.update_building_Data(_data);
            break;
          case 'unit' : // 单元
            _this.update_unit_Data(_data);
            break;
          case 'floor' : // 层
            _this.update_floor_Data(_data);
            break;
          default :
            break;
        }
      },
      // 删除
      removeFun: function (_data) {
        var _this = this;
        var type = _data.type;
        switch (type) {
          case 'community' : // 小区
            var content = '确定删除 ' + _data.title + ' 的全部信息？';
            _this.$Modal.confirm({
              title: '温馨提示',
              content: content,
              onOk: () => {
                _this.del_community_Data(_data);
              },
              onCancel: () => {

              }
            });
            break;
          case 'building' : // 楼
            var content = '确定删除 ' + _data.title + ' 的全部信息？';
            _this.$Modal.confirm({
              title: '温馨提示',
              content: content,
              onOk: () => {
                _this.del_building_Data(_data);
              },
              onCancel: () => {

              }
            });
            break;
          case 'unit' : // 单元
            var content = '确定删除 ' + _data.title + ' 的全部信息？';
            _this.$Modal.confirm({
              title: '温馨提示',
              content: content,
              onOk: () => {
                _this.del_unit_Data(_data);
              },
              onCancel: () => {

              }
            });
            break;
          case 'floor' : // 层
            var content = '确定删除 ' + _data.title + ' 的全部信息？';
            _this.$Modal.confirm({
              title: '温馨提示',
              content: content,
              onOk: () => {
                _this.del_floor_Data(_data);
              },
              onCancel: () => {

              }
            });
            break;
          default :
            break;
        }
      },
      // 隐藏编辑框
      cancelMobile: function () {
        var _this = this;
        _this.community_Data.showModal = false;
        _this.building_Data.showModal = false;
        _this.unit_Data.showModal = false;
        _this.floor_Data.showModal = false;
        _this.house_Data.showModal = false;
      },
      // 添加信息，小区
      add_community_Data: function (_data) {
        var _this = this;
        _this.community_Data.ajaxType = 'add';
        _this.community_Data.name = '';
        _this.community_Data.pid = _data.id;
        _this.community_Data.showModal = true;
      },
      // 修改信息，小区
      update_community_Data: function (_data) {
        var _this = this;
        _this.community_Data.ajaxType = 'update';
        _this.community_Data.name = _data.title;
        _this.community_Data.id = _data.id;
        _this.community_Data.showModal = true;
      },
      // 保存信息，小区
      save_community_Data: function () {
        var _this = this;
        var name = _this.community_Data.name;
        var id = _this.community_Data.id;
        var pid = _this.community_Data.pid;
        if (name == '') {
          _this.$Message.error('请填写小区名称!');
          return false;
        }
        var data = {
          uid: Util.toJson(localStorage.getItem('userInfo')).id,
          pid: pid,
          id: id,
          name: name,
        };
        var url = '/sd/social-repo/community/add';
        if (_this.community_Data.ajaxType == 'update') {
          url = '/sd/social-repo/community/update';
        }
        var params = {
          url: url,
          type: Util.method.get,
          data: data,
          success: _successFun
        };
        Util.ajax(_this, params);
        _this.saveLoading = true;
        function _successFun(res) {
          _this.saveLoading = false;
          if (res.result == 0) {
            var data = res.data || [];
            _this.getTreeData();
            _this.community_Data.id = '';
            _this.community_Data.pid = '';
            _this.community_Data.name = '';
            _this.community_Data.showModal = false;
          } else {
            _this.$Message.error('保存小区信息失败!');
          }
        }
      },
      // 删除信息，小区
      del_community_Data: function (_data) {
        var _this = this;
        var id = _data.id;
        var data = {
          uid: Util.toJson(localStorage.getItem('userInfo')).id,
          id: id,
        };
        var url = '/sd/social-repo/community/delete';
        var params = {
          url: url,
          type: Util.method.get,
          data: data,
          success: _successFun
        };
        Util.ajax(_this, params);
        function _successFun(res) {
          if (res.result == 0) {
            _this.getTreeData();
          } else {
            _this.$Message.error('删除小区信息失败!');
          }
        }
      },
      // 添加信息，楼
      add_building_Data: function (_data) {
        var _this = this;
        _this.building_Data.ajaxType = 'add';
        _this.building_Data.name = '';
        _this.building_Data.pid = _data.id;
        _this.building_Data.showModal = true;
      },
      // 修改信息，楼
      update_building_Data: function (_data) {
        var _this = this;
        _this.building_Data.ajaxType = 'update';
        _this.building_Data.name = _data.title;
        _this.building_Data.id = _data.id;
        _this.building_Data.showModal = true;
      },
      // 保存信息，楼
      save_building_Data: function () {
        var _this = this;
        var name = _this.building_Data.name;
        var id = _this.building_Data.id;
        var pid = _this.building_Data.pid;
        if (name == '') {
          _this.$Message.error('请填写楼号!');
          return false;
        }
        var data = {
          uid: Util.toJson(localStorage.getItem('userInfo')).id,
          cid: pid,
          id: id,
          name: name,
        };
        var url = '/sd/social-repo/building/add';
        if (_this.building_Data.ajaxType == 'update') {
          url = '/sd/social-repo/building/update';
        }
        var params = {
          url: url,
          type: Util.method.get,
          data: data,
          success: _successFun
        };
        Util.ajax(_this, params);
        _this.saveLoading = true;
        function _successFun(res) {
          _this.saveLoading = false;
          if (res.result == 0) {
            var data = res.data || [];
            _this.getTreeData();
            _this.building_Data.id = '';
            _this.building_Data.pid = '';
            _this.building_Data.name = '';
            _this.building_Data.showModal = false;
          } else {
            _this.$Message.error('保存小区楼号信息失败!');
          }
        }
      },
      // 删除信息，楼
      del_building_Data: function (_data) {
        var _this = this;
        var id = _data.id;
        var data = {
          uid: Util.toJson(localStorage.getItem('userInfo')).id,
          id: id,
        };
        var url = '/sd/social-repo/building/delete';
        var params = {
          url: url,
          type: Util.method.get,
          data: data,
          success: _successFun
        };
        Util.ajax(_this, params);
        function _successFun(res) {
          if (res.result == 0) {
            _this.getTreeData();
          } else {
            _this.$Message.error('删除小区楼号信息失败!');
          }
        }
      },
      // 添加信息，单元
      add_unit_Data: function (_data) {
        var _this = this;
        _this.unit_Data.ajaxType = 'add';
        _this.unit_Data.name = '';
        _this.unit_Data.pid = _data.id;
        _this.unit_Data.showModal = true;
      },
      // 修改信息，单元
      update_unit_Data: function (_data) {
        var _this = this;
        _this.unit_Data.ajaxType = 'update';
        _this.unit_Data.name = _data.title;
        _this.unit_Data.id = _data.id;
        _this.unit_Data.showModal = true;
      },
      // 保存信息，单元
      save_unit_Data: function () {
        var _this = this;
        var name = _this.unit_Data.name;
        var id = _this.unit_Data.id;
        var pid = _this.unit_Data.pid;
        if (name == '') {
          _this.$Message.error('请填写单元号!');
          return false;
        }
        var data = {
          uid: Util.toJson(localStorage.getItem('userInfo')).id,
          bid: pid,
          id: id,
          unit_name: name,
        };
        var url = '/sd/social-repo/unit/add';
        if (_this.unit_Data.ajaxType == 'update') {
          url = '/sd/social-repo/unit/update';
        }
        var params = {
          url: url,
          type: Util.method.get,
          data: data,
          success: _successFun
        };
        Util.ajax(_this, params);
        _this.saveLoading = true;
        function _successFun(res) {
          _this.saveLoading = false;
          if (res.result == 0) {
            var data = res.data || [];
            _this.getTreeData();
            _this.unit_Data.id = '';
            _this.unit_Data.pid = '';
            _this.unit_Data.name = '';
            _this.unit_Data.showModal = false;
          } else {
            _this.$Message.error('保存小区单元信息失败!');
          }
        }
      },
      // 删除信息，单元
      del_unit_Data: function (_data) {
        var _this = this;
        var id = _data.id;
        var data = {
          uid: Util.toJson(localStorage.getItem('userInfo')).id,
          id: id,
        };
        var url = '/sd/social-repo/unit/delete';
        var params = {
          url: url,
          type: Util.method.get,
          data: data,
          success: _successFun
        };
        Util.ajax(_this, params);
        function _successFun(res) {
          if (res.result == 0) {
            _this.getTreeData();
          } else {
            _this.$Message.error('删除小区单元信息失败!');
          }
        }
      },
      // 添加信息，楼层
      add_floor_Data: function (_data) {
        var _this = this;
        _this.floor_Data.ajaxType = 'add';
        _this.floor_Data.name = '';
        _this.floor_Data.pid = _data.id;
        _this.floor_Data.showModal = true;
      },
      // 修改信息，楼层
      update_floor_Data: function (_data) {
        var _this = this;
        _this.floor_Data.ajaxType = 'update';
        _this.floor_Data.name = _data.title;
        _this.floor_Data.id = _data.id;
        _this.floor_Data.showModal = true;
      },
      // 保存信息，楼层
      save_floor_Data: function () {
        var _this = this;
        var name = _this.floor_Data.name;
        var id = _this.floor_Data.id;
        var pid = _this.floor_Data.pid;
        if (name == '') {
          _this.$Message.error('请填写楼层!');
          return false;
        }
        var data = {
          uid: Util.toJson(localStorage.getItem('userInfo')).id,
          unit_id: pid,
          id: id,
          name: name,
        };
        var url = '/sd/social-repo/floor/add';
        if (_this.floor_Data.ajaxType == 'update') {
          url = '/sd/social-repo/floor/update';
        }
        var params = {
          url: url,
          type: Util.method.get,
          data: data,
          success: _successFun
        };
        Util.ajax(_this, params);
        _this.saveLoading = true;
        function _successFun(res) {
          _this.saveLoading = false;
          if (res.result == 0) {
            var data = res.data || [];
            _this.getTreeData();
            _this.floor_Data.id = '';
            _this.floor_Data.pid = '';
            _this.floor_Data.name = '';
            _this.floor_Data.showModal = false;
          } else {
            _this.$Message.error('保存小区楼层信息失败!');
          }
        }
      },
      // 删除信息，楼层
      del_floor_Data: function (_data) {
        var _this = this;
        var id = _data.id;
        var data = {
          uid: Util.toJson(localStorage.getItem('userInfo')).id,
          id: id,
        };
        var url = '/sd/social-repo/floor/delete';
        var params = {
          url: url,
          type: Util.method.get,
          data: data,
          success: _successFun
        };
        Util.ajax(_this, params);
        function _successFun(res) {
          if (res.result == 0) {
            _this.getTreeData();
          } else {
            _this.$Message.error('删除小区楼层信息失败!');
          }
        }
      },
      // 添加房屋
      add_house: function () {
        var _this = this;
        _this.house_Data.ajaxType = 'add';
        _this.house_Data.name = '';
        _this.house_Data.pid = _this.id;
        _this.house_Data.showModal = true;
      },
      // 添加信息，房屋
      add_house_Data: function (_data) {
        var _this = this;
        _this.house_Data.ajaxType = 'add';
        _this.house_Data.name = '';
        _this.house_Data.pid = _data.id;
        _this.house_Data.showModal = true;
      },
      // 修改信息，房屋
      update_house_Data: function (_data) {
        var _this = this;
        _this.house_Data.ajaxType = 'update';
        _this.house_Data.name = _data.house;
        _this.house_Data.id = _data.id;
        _this.house_Data.showModal = true;
      },
      // 保存信息，房屋
      save_house_Data: function () {
        var _this = this;
        var name = _this.house_Data.name;
        var id = _this.house_Data.id;
        var pid = _this.house_Data.pid;
        if (name == '') {
          _this.$Message.error('请填写门牌号!');
          return false;
        }
        var regu = /^\+?[1-9][0-9]*$/;
        var regu2 = /^\-[1-9][0-9]*$/;
        if (!(regu.test(name) || regu2.test(name))) {
          _this.$Message.error('门牌号只能为非0的数字!');
          return false;
        }
        var data = {
          uid: Util.toJson(localStorage.getItem('userInfo')).id,
          fid: pid,
          id: id,
          house_number: name,
        };
        var url = '/sd/social-repo/house/addHouse';
        if (_this.house_Data.ajaxType == 'update') {
          url = '/sd/social-repo/house/update';
        }
        var params = {
          url: url,
          type: Util.method.get,
          data: data,
          success: _successFun
        };
        Util.ajax(_this, params);
        _this.saveLoading = true;
        function _successFun(res) {
          _this.saveLoading = false;
          if (res.result == 0) {
            var data = res.data || [];
            _this.getTreeData();
            _this.selectionArr = [];
            _this.getData();
            _this.house_Data.id = '';
            _this.house_Data.pid = '';
            _this.house_Data.name = '';
            _this.house_Data.showModal = false;
          } else {
            _this.$Message.error('保存小区楼层信息失败!');
          }
        }
      },
      // 删除信息，房屋
      del_house_Data: function () {
        var _this = this;
        var selectionArr = _this.selectionArr;
        if (selectionArr.length == 0) {
          _this.$Message.error('请填选择要删除的数据!');
          return false;
        }
        var selectionIds = [];
        for (var k in selectionArr) {
          if (!selectionArr[k]) {
            continue;
          }
          var id = selectionArr[k].id;
          selectionIds.push(id);
        }
        Modal.confirm(_this, {content: '确定删除选中的信息？'}, function () {
          var data = {
            uid: Util.toJson(localStorage.getItem('userInfo')).id,
            id: selectionIds,
          };
          var params = {
            url: '/sd/social-repo/house/deleteMultiple',
            type: Util.method.get,
            data: data,
            success: _successFun
          };
          Util.ajax(_this, params);
          function _successFun(res) {
            if (res.result == 0) {
              _this.page = 1;
              _this.getData();
            } else {
              _this.$Message.error('删除信息失败!');
            }
          }
        }, function () {
        });
      },

    }
  };
</script>

<style>

</style>
